<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
?>
<p class="categoryheader"><?=$pageParams["title"];?></p>
<form method="post" action="/crontab/query_crontab.php" name="bdform" id="bdform">

<table border="0" cellpadding="5" cellspacing="1" width="900">
<tr valign="top">
<td>

<table border="0" cellpadding="5" cellspacing="1" width="400" class="formtable">
<tr valign="top">
	<td class="formfielddesc">Filename:<br />
		<span class="required">{required}</span></td>
	<td class="formfield">
		<input type="text" value="<?=$cronInfo["filename"];?>" name="filename" class="textfield" />
	</td>
</tr>
<tr valign="top">
	<td class="formfielddesc">Server:<br />
	</td>
	<td class="formfield">
		<select name="serverID" size="1" class="selectfield">
		<option value="">None</option>
		<?
		
		$aCriteria = array(
			"active" => -1
			);
			
		$aServers = $BigDaddyData->GetServers($aCriteria);
		
		if (is_array($aServers["aResults"]))
		{
			foreach ($aServers["aResults"] as $nIndex => $row)
			{
				if ($cronInfo["serverID"]==$row["serverID"])
				{
					$s=" selected";
				}
				else
				{
					$s="";
				}
			?>
				<option value="<?=$row["serverID"];?>"<?=$s;?>><?=$row["hostname"];?></option>		
			<?
			}
		}
		?>
		</select>
	
	</td>
</tr>
<tr valign="top">
	<td class="formfielddesc">Notes:<br />
	</td>
	<td class="formfield">
		<textarea name="notes" class="textareafield" wrap="virtual"><?=$cronInfo["notes"];?></textarea>
	
	</td>
</tr>
</table>

</td>
<td>

	<table border="0" cellpadding="5" cellspacing="1" width="500" class="formtable">
	<tr valign="top">
	<td class="formfielddesc"><b>Categories</b></td>
	</tr>
	<td class="formfield">
	
	<?
	
	if ($type=="edit")
	{
		$aCronCategories = $BigDaddyData->GetCronCategoriesByCronID($_REQUEST["cronID"]);
		
		if (is_array($aCronCategories))
		{
			foreach ($aCronCategories as $nIndex => $row)
			{
				$cronMapArray[$row["categoryID"]]=1;
			}
		}
	}
	
	$aCronCategories = $BigDaddyData->GetCronCategories();
	if (is_array($aCronCategories))
	{
		foreach ($aCronCategories as $nIndex => $row)
		{
			if ($cronMapArray[$row["ID"]]==1)
			{
				$c=" checked";
			}
			else
			{
				$c="";
			}
			?>
			<input type="checkbox" name="cat[]" value="<?=$row["ID"];?>" <?=$c;?> /> <?=$row["name"];?><br />
			<?
		}
	}
	?>
	
	
	</td>
	</tr>
	</table>
	
	<br />
	<table border="0" cellpadding="5" cellspacing="1" width="500" class="formtable">
	<tr valign="top">
	<td class="formfielddesc" colspan="2"><b>Monitoring</b></td>
	</tr>
	<td class="formfielddesc">Warning INI</td>
	<td class="formfield">
	<select name="iniID" size="1" class="selectfield">
	<?
	
	$aIniFiles = $BigDaddyData->GetIniFiles();
	
	if (is_array($aIniFiles))
	{
		foreach ($aIniFiles as $nIndex => $row)
		{
			if ($cronInfo["iniID"]==$row["ID"])
			{
				$s=" selected";
			}
			else
			{
				$s="";
			}
			?>
			<option value="<?=$row["ID"];?>"<?=$s;?>><?=$row["name"];?></option>
			<?
		}
	}
	?>
	</select>
	
	
	</td>
	</tr>
	<tr>
	<td class="formfielddesc">Start Level</td>
	<td class="formfield">
	<select name="mon_startlevel" size="1" class="selectfield">
	<?
	for ($i=1; $i<6; $i++)
	{
		if ($i==$cronInfo["mon_startlevel"])
		{
			$s=" selected";
		}
		else
		{
			$s="";
		}
	?>
	<option value="<?=$i;?>"<?=$s;?>><?=$i;?></option>
	<?
	}
	?>
	</select>
	
	</td>
	</tr>
	<tr>
	<td class="formfielddesc">End Level</td>
	<td class="formfield">
	<select name="mon_endlevel" size="1" class="selectfield">
	<option value="0">All Levels</option>
	<?
	for ($i=1; $i<6; $i++)
	{
		if ($i==$cronInfo["mon_endlevel"])
		{
			$s=" selected";
		}
		else
		{
			$s="";
		}
	?>
	<option value="<?=$i;?>"<?=$s;?>><?=$i;?></option>
	<?
	}
	?>
	</select>
	
	</td>
	</tr>
	<tr>
	<td class="formfielddesc">Start Threshold</td>
	<td class="formfield">
	<input type="text" name="mon_threshold" value="<?=$cronInfo["mon_threshold"];?>" class="textfield" />
	
	</td>
	</tr>
	</table>
	

</td>
</tr>
<tr valign="top">
	<td class="formfielddesc" colspan="2">
	<div align="center"><?
	if ($type=="addnew")
	{
	?>
		<input type="hidden" name="action" value="addcron" />
	<?
	}
	
	if ($type=="edit")
	{
	?>
		<input type="hidden" name="action" value="editcron" />
		<input type="hidden" name="cronID" value="<?=$_REQUEST["cronID"];?>" />
	<?
	}
	?></div>
	
	</td>
</tr>
</table>

<br />



</form>
